﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;
using Controller;
using WindowsFormsApplication1;
using Test_moduler;

namespace ASS_CNPM
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();

            var thread = new Thread(ThreadStart);
            thread.TrySetApartmentState(ApartmentState.STA);
            thread.Start(); 

            Application.Run(new TestForm());

        }
        private static void ThreadStart()
        {

            MainInterface mainInterface = new MainInterface();
            Tester testController = new Tester(ref mainInterface);
            PumpController pumpController = new PumpController(testController, ref mainInterface);
            testController.CreateLinkerPumpController(ref pumpController);

            Thread pumpControllerThead = pumpController.GetThread();
            mainInterface.AddPumpControllerThead(ref pumpControllerThead);
            Thread testerThread = testController.GetThread();
            mainInterface.AddTesterThread(ref testerThread);
            Application.Run(mainInterface); // <-- other form started on its own UI thread
        }
    }
}
